{include "Common/header"}
<link href="__CONTENT__/css/user.css" rel="stylesheet" />
 <!--<h1 style="text-align:center;">推荐人:{$user['username']}</h1>-->
 <h1 style="text-align:center;">立即注册成为丝薇发型设计沙龙会员</h1>
<meta content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" name="viewport" />
<form id="quick-login-form" action="#" autocomplete="off" method="post" style="-webkit-transform-origin: 0px 0px 0px; opacity: 1; -webkit-transform: scale(1, 1);">
        <dl class="list list-in"><dd><dl>
            <dd class="kv-line-r dd-padding" data-com="smsBtn" data-requrl="/account/mobilelogincode">
                <input type="tel" maxlength="11" name="phone" id="phone" class="input-weak kv-k" placeholder="请输入手机号">
                <button id="smsCode" type="button" class="btn btn-weak kv-v" gaevent="imt/buy/quickBuy/send">发送验证码</button>
            </dd>
            <dd class="dd-padding">
                <input class="input-weak J_input_sms" maxlength="4" name="code" type="tel" pattern="[0-9]+" placeholder="请输入手机短信中的验证码" >
            </dd>
        </dl></dd></dl>
        <div class="btn-wrapper">
		<button type="submit" gaevent="imt/login/quick" class="btn btn-larger btn-block mj_login">注册/绑定</button>
        </div>
    </form>
     <h1 style="text-align:center;">注册成功后,您和推荐人都可获得10积分</h1>
     <p style="text-align:center;"><img src="__CONTENT__/images/safeqrcode.jpg" /></p>
     <p style="text-align:center;">关注微信号:宜昌英泰发型私务所</p>
<script>
var number;
var _countdown;
function countdown(){
	if(number==0){
		clearInterval(_countdown);
		$("#smsCode").html('发送验证码').removeAttr("disabled");
	}else{
		$("#smsCode").html(number);
		--number;
	}
}
$(function(){
	function is_phone(phone){
		if (phone.length!=11||!/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/.test(phone)){
			return false;
		}
		return true;
	}
	$("#smsCode").click(function(){
		var phone=$("#phone").val();
		if(is_phone(phone)==false){
			alert('手机号码不正确');
			return false;
		}
		$.get("{:U('sendSms')}",{phone:phone},function(rs){
			if(rs.status!=1){
				alert(rs.msg);
			}else{
				number=120;
				_countdown=setInterval("countdown()",1000);
				$("#smsCode").attr("disabled","disabled");
			}
		},'json');
	});
	$(":submit").click(function(){
		$(this).attr("disabled",true);
		var phone=$.trim($("#phone").val());
		var code=$.trim($("input[name='code']").val());
		var uid="{$_GET['uid']|'0'}";
		if(is_phone(phone)==false){
			alert('手机号码不正确');
			return false;
		}
		if(code.length!=4){
			alert('效验码不正确');
			return false;
		}
		$.post("{:U('login')}",{phone:phone,code:code,uid:uid},function(rs){
			if(rs.status==1){
				alert('恭喜你,注册成功,您和推荐人都可获得10积分')
			}else{
			}
		},'json');
		return false;
	});
});
</script>
{include "Common/footer"}